home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.5)
-
- import os
- import shutil
- import tempfile
- import unittest
- import database
- import olddatabaseupgrade
- import storedatabase
- import databaseupgrade
- import databasesanity
- import resources
- from test.framework import EventLoopTest
-
- class TestConvert(EventLoopTest):
-
- def setUp(self):
- storedatabase.skipOnRestore = True
- self.utilDotFailedOkay = True
- self.tmpPath = tempfile.mktemp()
- EventLoopTest.setUp(self)
-
-
- def tearDown(self):
- storedatabase.skipOnRestore = False
-
- try:
- os.unlink(self.tmpPath)
- except:
- pass
-
- EventLoopTest.tearDown(self)
-
-
- def checkConversion(self):
- olddatabaseupgrade.convertOldDatabase(self.tmpPath)
- objects = storedatabase.restoreObjectList(self.tmpPath)
- self.assert_(len(objects) > 0)
- databasesanity.checkSanity(objects, fixIfPossible = True, quiet = True, reallyQuiet = True)
-
-
- def testConvert82(self):
- shutil.copyfile(resources.path('testdata/olddatabase-0.8.2'), self.tmpPath)
- self.checkConversion()
- shutil.copyfile(resources.path('testdata/olddatabase-0.8.2-2'), self.tmpPath)
- self.checkConversion()
-
-
- def testConvert81(self):
- shutil.copyfile(resources.path('testdata/olddatabase-0.8.1'), self.tmpPath)
- self.checkConversion()
-
-
- def testBug2003(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.2003'), self.tmpPath)
- self.checkConversion()
-
-
- def testBug2515(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.2515'), self.tmpPath)
- self.checkConversion()
-
-
- def testBug2685(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.2685'), self.tmpPath)
- self.checkConversion()
-
-
- def testBug3163(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.3163'), self.tmpPath)
- self.checkConversion()
-
-
- def testBug4039(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.4039'), self.tmpPath)
- db = database.DynamicDatabase()
- storedatabase.skipOnRestore = False
- storedatabase.restoreDatabase(db = db, pathname = self.tmpPath)
- self.assertEquals(len(db.objects), 0)
- self.assert_(not self.hasIdles())
-
-
- def testBug4039part2(self):
- shutil.copyfile(resources.path('testdata/olddatabase.bug.4039.part2'), self.tmpPath)
- db = database.DynamicDatabase()
- storedatabase.skipOnRestore = False
- storedatabase.restoreDatabase(db = db, pathname = self.tmpPath)
- self.assertEquals(len(db.objects), 2)
- self.assert_(self.hasIdles())
-
-
-